package com.google.code.p.narcissus.core.util;

import java.awt.Rectangle;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;

import com.google.code.p.narcissus.core.NarcissusException;
import com.google.code.p.narcissus.core.ScreenShooter;
import com.google.code.p.narcissus.core.model.ReferenceMetaData;
import com.google.code.p.narcissus.core.reference.ReferenceMetaDataMapper;


/**
 * Utility class allowing creating reference meta data files, containging the false-positive zones.
 * <p>
 * To be used to define test cases.
 * </p>
 * 
 * @author Jerome JADOULLE [JADOJ] - 3 aout 2010
 */
public class ReferenceMetaDataCreator {

	public void createMetaDataForReference(String rootFolder, String testClass, String testName, String referenceName, List<Rectangle> falsePositiveZones)
			throws FileNotFoundException, NarcissusException {
		ReferenceMetaData metaData = new ReferenceMetaData(falsePositiveZones, "This is a user comment for the reference");
		File metaDataFileLocation = new File(rootFolder + "/" + ScreenShooter.REFERENCES_FOLDER_NAME + "/" + testClass + "/" + testName + "/"
				+ referenceName + ".xml");

		ReferenceMetaDataMapper.toXml(metaData, metaDataFileLocation);
	}
}